using System.Collections.Generic;

namespace Mistral.Updater
{
	public class UpdateItem : IUpdateItem
	{
		private string m_name;
		private string m_fileName;
		private bool m_bEnable;
		private List<UpdateItem> m_dependent = new List<UpdateItem>();

		public UpdateItem( string name, string fileName )
		{
			m_name = name;
			m_fileName = fileName;
		}

		#region IUpdateItem Members

		public string Name
		{
			get { return m_name; }
		}

		public string FileName
		{
			get { return m_fileName; }
		}

		public bool Enable
		{
			get{ return m_bEnable; }
			set
			{
				m_bEnable = value;
				foreach ( UpdateItem item in m_dependent )
				{
					item.Enable = value;
				}
			}
		}

		public IUpdateItem[] Dependent
		{
			get { return m_dependent.ToArray(); }
		}

		#endregion
	}
}
